package com.mfhcd.facepay.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.mfhcd.facepay.R;
import com.mfhcd.facepay.viewholder.ViewHolder;

import java.util.List;

/**
 * Author：石强
 * E-Mail: shiqiang@mfhcd.com
 * Date：2019-09-19
 * 版权所有 © 现代金融控股（成都）有限公司
 */
public abstract class BaseAdapter<T, B extends ViewDataBinding> extends BaseQuickAdapter<T, ViewHolder<B>>
        implements BaseQuickAdapter.RequestLoadMoreListener{
    public BaseAdapter(int layoutResId) {
        super(layoutResId);
    }

    public BaseAdapter(@Nullable List<T> data) {
        super(data);
    }

    public BaseAdapter(int layoutResId, @Nullable List<T> data) {
        super(layoutResId, data);
    }

    @Override
    protected View getItemView(int layoutResId, ViewGroup parent) {
        if (layoutResId != mLayoutResId) {
            return super.getItemView(layoutResId, parent);
        }
        B binding = DataBindingUtil.inflate(
                mLayoutInflater,
                layoutResId,
                parent,
                false);
        View view = binding.getRoot();
        view.setTag(R.id.BaseQuickAdapter_databinding_support, binding);
        return view;
    }

    @Override
    public void onLoadMoreRequested() {

    }
}
